New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amqp-connection-manager

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp-connection-manager

Auto-reconnect and round robin support for amqplib.

3.9.0
Source
npm
Version published
Weekly downloads
415K
-11.96%
Maintainers
1
Weekly downloads
 
Created

What is amqp-connection-manager?

The amqp-connection-manager package is a Node.js library that provides a high-level API for managing AMQP (Advanced Message Queuing Protocol) connections. It simplifies the process of connecting to AMQP brokers like RabbitMQ, handling reconnections, and managing channels.

What are amqp-connection-manager's main functionalities?

Creating a Connection

This feature allows you to create a connection to an AMQP broker. The connection manager handles reconnections automatically.

const amqp = require('amqp-connection-manager');

const connection = amqp.connect(['amqp://localhost']);

connection.on('connect', () => console.log('Connected!'));
connection.on('disconnect', params => console.log('Disconnected.', params.err.stack));

Creating a Channel

This feature allows you to create a channel and set up queues, exchanges, and bindings. The channel wrapper also supports JSON message encoding.

const amqp = require('amqp-connection-manager');

const connection = amqp.connect(['amqp://localhost']);
const channelWrapper = connection.createChannel({
    json: true,
    setup: channel => channel.assertQueue('my-queue', { durable: true })
});

channelWrapper.sendToQueue('my-queue', { hello: 'world' });

Handling Messages

This feature allows you to consume messages from a queue. The channel wrapper handles message acknowledgments and other channel-level operations.

const amqp = require('amqp-connection-manager');

const connection = amqp.connect(['amqp://localhost']);
const channelWrapper = connection.createChannel({
    setup: channel => channel.consume('my-queue', msg => {
        console.log(msg.content.toString());
        channel.ack(msg);
    })
});

Other packages similar to amqp-connection-manager

Keywords

amqp

FAQs

Package last updated on 04 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts